package acwing.周赛;

import java.util.Scanner;

/**
 * @author： li
 * @date： 2022-03-26 19:08
 * @version 1.0
 */

public class 最短路径 {
    public static void main(String[] args) {
        Scanner  sc = new Scanner(System.in);
        String in = sc.next();
        int x1=0,y1=0;
        int x=0,y=0;
        int[] b = new int[5];
        b[1]=1;//U
        b[2]=-1;//D
        b[3]=-1;//L
        b[4]=1;//R
        int dist,dist1=0;
        for(int i=0;i<in.length();i++){
            if(in.charAt(i)=='U')
                y+=b[1];
            if(in.charAt(i)=='D')
                y+=b[2];
            if(in.charAt(i)=='L')
                x+=b[3];
            if(in.charAt(i)=='R')
                x+=b[4];
            dist1++;
        }
//        System.out.println("x="+x+"x1="+x1);
        if((x==x1)&&(y==y1)) {
            System.out.println("NO");
        }else{
            dist=Math.abs(x-x1)+Math.abs(y-y1);
//            System.out.println("dist="+dist+"dist1="+dist1);
            if(Math.abs(x-x1)>=2||Math.abs(y-y1)>=2)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
    }
}
